package com.nancy.java_design.simple_factory.demo2;


public class SimpleCoffeeFactory {
    // 获取咖啡
    public static Coffee orderCoffee(String type) {
        Coffee coffee;
        if (type.equalsIgnoreCase("American")) {
            coffee = new AmericanCoffee();
        } else if (type.equalsIgnoreCase("Lattle")) {
            coffee = new LattleCoffee();
        } else {
            throw new RuntimeException("没有该种咖啡");
        }

        coffee.addMilk();
        coffee.addSugur();
        coffee.getName();

        return coffee;
    }

}
